<?php
/**
 * Created by PhpStorm.
 * User: Amitav Roy
 * Date: 18/11/14
 * Time: 12:37 PM
 */

if (!function_exists('dsm'))
{
    /**
     * This function will take a variable and give a formatted var dump.
     * Also exit flag can be passed.
     *
     * @param null $var
     * @param int  $exit
     */
    function dsm($var = null, $exit = 0)
    {
        if ($var == null)
            App::abort(500, 'A variable needs to be passed as an argument');

        echo '<pre>';
        print_r($var);
        echo '</pre>';

        if ($exit == 1)
            exit;
    }
}

if (!function_exists('getCustomerConfig'))
{
    /**
     * This function will take the name of a configuration present in the
     * Adminsiter package config file.
     *
     * @param null $confName
     *
     * @return mixed
     */
    function getCustomerConfig($confName = null)
    {
        if ($confName == null)
            App::abort(500, 'Configuration name is required');

        return Config::get("packages/amitavroy/administer/administer.{$confName}");
    }
}